<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2025/5/22
  Time: 17:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript">
    function register() {
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;

        let jsonData = {"username": username, password: password}

        let jsonObj = JSON.stringify(jsonData)
        $.ajax({
            method: 'post',
            url: '${pageContext.request.contextPath}/stu/regiser.do',
            contentType: 'application/json;charset=utf-8',
            data: jsonObj,
            success: function (resp) {
                alert(resp.username + ":" + resp.password)
            }
        })
    }
</script>
<html>
<head>
    <title>注册首页</title>
</head>
<body>
    用户名:<input type="text" name="username" id="username"><br>
    密码:<input type="text" name="password" id="password"><br>
    <input type="submit" value="注册" onclick="register()">
</body>
</html>
